package cn.wolfcode.luowowo.search.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;


/**
 * 攻略查询对象
 */
@Setter
@Getter
public class StrategySearchQuery extends QueryObject {

    private Long countryId = -1L;
    private Long provinceId = -1L;
    private Long themeId = -1L;
    private Long destId = -1L;


    private int type = -1;
    private Long typeValue = -1L;

    private String orderBy = "viewnum";

    public Pageable getPageable() {
        return PageRequest.of(super.getCurrentPage() - 1, super.getPageSize(), Sort.Direction.DESC, orderBy);
    }
    public Pageable getPageableWithSort() {
        return PageRequest.of(super.getCurrentPage() - 1, super.getPageSize());
    }
}
